home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
spoc88
/
loops
/
mc.bas
< prev
next >
Wrap
BASIC Source File
|
1988-06-13
|
4KB
|
89 lines
1 '┌───────────────────────────────────────────────────────────────┐
2 '│ MC.BAS │
3 '│ VERSION 1.0 │
4 '│ │
5 '│ Turbo Basic │
6 '│ (C) Copyright 1987 by Borland International │
7 '│ │
8 '│ System Requirements: │
9 '│ - DOS Version 2.0 or later │
10 '│ - 320K │
11 '│ │
12 '│ This program is a simple spreadsheet program that is provided │
13 '│ as an example of a simple application that can be done in │
14 '│ Turbo Basic. You are encouraged to study this program and │
15 '│ make any enhancements and modifications that you might want. │
21 '└───────────────────────────────────────────────────────────────┘
22
23 $DYNAMIC ' All arrays are DYNAMIC
24 $STACK 10240 ' to prevent stack overflow
25
26 $INCLUDE "MC0.INC" ' Global variables, named constant AND
27 ' array definition
28
29 $INCLUDE "MC1.INC" ' Miscellaneous commands AND utilities
30 ' (Keyboard,screen,toggles)
31
32 $INCLUDE "MC2.INC" ' Init, display & clear SpreadSheet grid
33
34 $INCLUDE "MC3.INC" ' Display Cells; move around Spreadsheet
35
36 $INCLUDE "MC4.INC" ' Load, Save AND Print a spreadsheet;
37 ' display on-line manual; DOS shell
39
40 $INCLUDE "MC5.INC" ' Procedures to evaluate formulas AND
41 ' recalculate the SpreadSheet
42
43 $INCLUDE "MC6.INC" ' Procedures to read, update AND format
44 ' cells; Commands dispatcher
45
46 $INCLUDE "MC7.INC" ' Some string functions
47
48 $INCLUDE "MC8.INC" ' Procedures to Read/Write records to or
49 ' from the Spreadsheet data structure
52 RANDOMIZE TIMER ' init random number generator
53 Begintimer=TIMER ' initial time
54
55 '┌────────────────────── MAIN PROGRAM ──────────────────────────┐
56
57 CALL Init
58 FileName$=FNGetCmd$
59 IF FNExists%(FileName$) THEN
60 CALL load
61 ELSE
62 CLS
63 CALL Grid
64 CALL GotoCell(GlobFX%, GlobFY%)
65 END IF
66
67 ' set up an LOOP UNTIL '/Q' command is chosen
68 DO
69 CALL ReadKBD(Ch$)
70 CALL IBMCh(Ch$)
71 SELECT CASE left$(Ch$,1)
72 CASE CHR$(5) '^E
73 CALL MoveUp
74 CASE CHR$(24), CHR$(10) '^X, ^J
75 CALL MoveDown
76 CASE CHR$(4), CHR$(13) '^D, ^M
77 CALL MoveRight
78 CASE CHR$(19) '^S
79 CALL MoveLeft
80 CASE CHR$(1) '^A
81 CALL MoveHome
82 CASE CHR$(6) '^F
83 CALL MoveEnd
84 CASE "/" ' Command Header
85 CALL Commands
86 CASE CHR$(%EditKey ) ' F2
87 CALL GetCell(GlobFX%, GlobFY%)
88 CASE ELSE
89 IF ( left$(Ch$,1) >= " " ) AND ( left$(Ch$,1) <= CHR$(255))
90 THEN CALL GetCell(GlobFX%, GlobFY%)
91 END IF
92 END SELECT
93 LOOP UNTIL CalcExit%
94
95 END
96 '└─────────────────────────── END MAIN PROGRAM ──────────────────┘